<template>
  <el-row>
    <el-row style="min-width:1300px">
      <el-form :model="formInline" class="search_prod" label-width="120px">
        <el-form-item label="商品名称">
          <el-col :span="4">
            <el-col :span="16" class="search_input_width">
              <el-input size="small" placeholder="商品名称" v-model="formInline.title"></el-input>
            </el-col>
          </el-col>
          <el-col class="tr col_label" :span="3">用户名&nbsp;&nbsp;&nbsp;</el-col>
          <el-col :span="4">
            <el-col :span="16" class="search_input_width">
              <el-input size="small" placeholder="用户名" v-model="formInline.username"></el-input>
            </el-col>
          </el-col>
          <el-col class="tr col_label" :span="3">昵称&nbsp;&nbsp;&nbsp;</el-col>
          <el-col :span="4">
            <el-col :span="16">
              <el-input size="small" placeholder="昵称" v-model="formInline.nickname"></el-input>
            </el-col>
          </el-col>
        </el-form-item>
        <el-form-item>
          <el-row class="tl">
            <el-col :span="24">
              <el-button
                :loading="$store.state.isLoading"
                size="mini"
                type="primary"
                @click="subOrderInfo"
              >查询</el-button>
              <el-button
                :loading="$store.state.isLoading"
                size="mini"
                type="primary"
                @click="delOrderInfo"
              >一键清除</el-button>
            </el-col>
          </el-row>
        </el-form-item>
      </el-form>
    </el-row>
  </el-row>
</template>
<script>
export default {
  name: "productSearch",
  data() {
    return {
      createTime: [],
      pickerOptions2: {
        disabledDate(time) {
          return time.getTime() > Date.now();
        },
        shortcuts: [
          {
            text: "最近一周",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit("pick", [start, end]);
            }
          },
          {
            text: "最近一个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit("pick", [start, end]);
            }
          },
          {
            text: "最近三个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit("pick", [start, end]);
            }
          }
        ]
      },
      agentOptions: [
        { id: "0", title: "代理商购买" },
        { id: "1", title: "终端购买" }
      ],
      userStatu: [
        { id: "0", title: "未发货" },
        { id: "1", title: "已发货" },
        { id: "2", title: "申请退货" },
        { id: "3", title: "退货成功" }
      ],

      formInline: {
        title: "",
        username: "",
        nickname: ""
      },
      regionList: [],
      regionProps: {
        value: "y",
        label: "t",
        children: "z"
      },
      op: []
    };
  },
  components: {},
  mounted() {},
  methods: {
    exportExcel() {
      var params = JSON.parse(JSON.stringify(this.formInline));
      this.$fnc.postExcelFile(params, "/api/admin/export/stock");
    },
    delOrderInfo() {
      this.formInline = {
        title: "",
        username: "",
        nickname: ""
      };
      this.createTime = [];
      this.$emit("sendUserSearch", this.formInline);
    },
    subOrderInfo() {
      this.$emit("sendUserSearch", this.formInline);
    }
  },
  created() {},
  watch: {
    createTime(val) {
      if (val != null) {
        this.formInline.created_time_begin = this.$fnc.phptime(val[0]);
        this.formInline.created_time_end = this.$fnc.phptime(val[1]);
      } else {
        this.formInline.created_time_begin = "";
        this.formInline.created_time_end = "";
      }
    }
  }
};
</script>
<style lang="less" scoped>
.search_prod {
  padding: 10px 20px 0;
  > .el-form-item {
    margin-bottom: 0 !important;
  }
}
.top_weiy {
  position: relative;
  top: -1px;
}
.xz {
  transform: rotate(-90deg);
}
.xzz {
  transform: rotate(90deg);
}
.open_order_search {
  margin-top: 10px;
  span {
    font-size: 13px;
    color: #666;
    cursor: pointer;
  }

  span:hover {
    color: #118bd8 !important;
  }
}
.open_con {
  overflow: hidden;
  transition: all 0.3s linear;
}
</style>
